import { Global, Module } from '@nestjs/common';
import { UserModule } from './modules/user/user.module';

import { TypeOrmModule } from '@nestjs/typeorm';

// import { User } from './Entities/User.dao';
import { LoginModule } from './modules/login/login.module';
import { JwtModule, JwtService } from '@nestjs/jwt';

@Global()
@Module({
  imports: [TypeOrmModule.forRoot(
    {
      'type': 'mysql',
      'host': 'localhost',
      'port': 3306,
      'username': 'root',
      'password': '',
      'database': 'testhl',
      "timezone": "+8",

      'entities': ["dist/Entities/**/**/*.dao{.ts,.js}"],
      'migrations': ['migrations/*.js'],
      
      'cli': {
        'migrationsDir': 'migrations',
      },
      'synchronize': true,
    },
  ),
    UserModule,
    LoginModule,
  JwtModule.registerAsync({
    useFactory() {
      return {
        secret: "fasdfdsafd,asfd.;fjd31n2sadsadasal;s"
      }
    }
  })
  ],
  controllers: [],
  providers: [],
  exports: [JwtModule]
})
export class AppModule {
}
